package com.hnkywl.sts.action.sfgl;

import com.hnkywl.sts.dao.sfgl.SfkglDao;
import com.hnkywl.sts.entity.organ.Nbgs;
import com.hnkywl.sts.entity.sfgl.Sfk;
import com.hnkywl.sts.entity.sys.Gncz;
import com.hnkywl.sts.entity.sys.Yg;
import com.hnkywl.sts.entity.zjgl.Pj;
import com.hnkywl.sts.service.htgl.HtService;
import com.hnkywl.sts.service.organ.GsjgService;
import com.hnkywl.sts.service.sfgl.KhskdService;
import com.hnkywl.sts.service.sys.GnczService;
import com.hnkywl.sts.service.sys.YgService;
import com.hnkywl.sts.service.zjgl.PjglService;
import com.hnkywl.sts.util.POIUtil;
import jxl.Sheet;
import jxl.Workbook;
import net.ruixin.web.struts2.SimpleActionSupport;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.Region;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Actions;
import org.apache.struts2.convention.annotation.Namespace;
import org.hibernate.tool.hbm2x.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: cyh
 * Date: 13-4-19
 * Time: 上午10:40
 * To change this template use File | Settings | File Templates.
 */
@Namespace("/sfgl/khskd")
public class KhskdAction extends SimpleActionSupport {

    private Date khskdStart;
    private Date khskdEnd;
    private  String bm;
    private  String sbgsMc;
    private Long nbgsId;
    private String gldwMc;
    private  String zt;
    private String skr;
    //分页组件 起始位置
    private int page;
    //分页组件 页面大小
    private int rows = 10;
    //申报公司机构名称
    private String sbgs;
    //申报公司机构Id
    private Long sbgsId;

    private KhskdService khskdService;

    private String sysDate;

    private Long khskdId;

    private GsjgService gsjgService;

    private Sfk khskd;


    //收款管理的查询分页显示
    @Action("khskdList")
    public void ygList() {
        this.renderJson(this.khskdService.findAllKhskd(khskdStart, khskdEnd, bm, sbgsMc, gldwMc, zt, skr, page, rows));
    }

    @Action("khskd")
    public String khskd() {
        SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd");
        sysDate = simple.format(new Date());
        return SUCCESS;
    }

    @Actions({@Action("khskd_content"), @Action("khskd_detail")})
    public String khskdContent() {
        Yg yg = YgService.getCurrentYg();
        Long gsId = YgService.getCurrentYgGsId();
        Long zggsId = YgService.getCurrentYgZgGsId();
        //进入update页面
        if (khskdId != null) {
            khskd = khskdService.findKhskdDetail(khskdId);
        } else {
            khskd = new Sfk();
            khskd.setSbr(yg);
            khskd.setSbgs((Nbgs) gsjgService.findGsjgDetail(zggsId));
        }
        return SUCCESS;
    }

    public Date getKhskdStart() {
        return khskdStart;
    }

    public void setKhskdStart(Date khskdStart) {
        this.khskdStart = khskdStart;
    }

    public Date getKhskdEnd() {
        return khskdEnd;
    }

    public void setKhskdEnd(Date khskdEnd) {
        this.khskdEnd = khskdEnd;
    }

    public String getBm() {
        return bm;
    }

    public void setBm(String bm) {
        this.bm = bm;
    }

    public String getSbgsMc() {
        return sbgsMc;
    }

    public void setSbgsMc(String sbgsMc) {
        this.sbgsMc = sbgsMc;
    }

    public Long getNbgsId() {
        return nbgsId;
    }

    public void setNbgsId(Long nbgsId) {
        this.nbgsId = nbgsId;
    }

    public String getGldwMc() {
        return gldwMc;
    }

    public void setGldwMc(String gldwMc) {
        this.gldwMc = gldwMc;
    }

    public String getZt() {
        return zt;
    }

    public void setZt(String zt) {
        this.zt = zt;
    }

    public String getSkr() {
        return skr;
    }

    public void setSkr(String skr) {
        this.skr = skr;
    }

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public String getSbgs() {
        return sbgs;
    }

    public void setSbgs(String sbgs) {
        this.sbgs = sbgs;
    }

    public Long getSbgsId() {
        return sbgsId;
    }

    public void setSbgsId(Long sbgsId) {
        this.sbgsId = sbgsId;
    }

    public KhskdService getKhskdService() {
        return khskdService;
    }

    public String getSysDate() {
        return sysDate;
    }

    public void setSysDate(String sysDate) {
        this.sysDate = sysDate;
    }

    public Long getKhskdId() {
        return khskdId;
    }

    public void setKhskdId(Long khskdId) {
        this.khskdId = khskdId;
    }

    public Sfk getKhskd() {
        return khskd;
    }

    public void setKhskd(Sfk khskd) {
        this.khskd = khskd;
    }

    @Autowired
    public void setKhskdService(KhskdService khskdService) {
        this.khskdService = khskdService;
    }
    @Autowired
    public void setGsjgService(GsjgService gsjgService) {
        this.gsjgService = gsjgService;
    }
}